package cn.cmkj.auction.data.http;

import org.json.JSONObject;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by cunguoyao on 2018/1/19.
 */

public class Shipping implements Serializable {

    public int dt_id;
    public String dt_name;
    public BigDecimal firstprice;

    //下单返回的订单对象解析中的快递
    public static Shipping parseFromJsonByOrderCreate(JSONObject json) {
        Shipping bean = new Shipping();
        bean.dt_id = json.optInt("dt_id", 0);
        bean.dt_name = json.optString("dt_name", "");
        bean.firstprice = BigDecimal.valueOf(json.optDouble("firstprice", 0));
        return bean;
    }

    //订单详情对象解析中的快递
    public static Shipping parseFromJsonByOrderDetail(JSONObject json) {
        Shipping bean = new Shipping();
        bean.dt_id = json.optInt("dt_id", 0);
        bean.dt_name = json.optString("shipping_name", "");
        bean.firstprice = BigDecimal.valueOf(json.optDouble("cost_shipping", 0));
        return bean;
    }
}
